package com.compass.vo;

import lombok.Data;

/**
 * Created with IntelliJ IDEA.
 * User: li
 * Date: 2019/3/10
 * Time: 16:56
 * PROJECT：compass
 * PACKAGE: com.compass
 *
 * @author:55324936@qq.com To change this template use File | Settings | File Templates.
 */
@Data
public class ResponseMessage {
    private String msg;
    private Integer code;
    private boolean success;
    private Object obj;
    ResponseMessage(boolean success,Integer code){
        this.success=success;
        this.code=code;
    }
    ResponseMessage(boolean success,Integer code,String msg){
        this.success=success;
        this.code=code;
        this.msg=msg;
    }
    ResponseMessage(boolean success,Integer code,Object obj){
        this.success=success;
        this.code=code;
        this.obj=obj;
    }
    public static ResponseMessage errorResponse(String msg){
        return new ResponseMessage(false,-400,msg);
    }
    public static ResponseMessage errorResponse(Integer code,String msg){
        return new ResponseMessage(false,code,msg);
    }
    public static ResponseMessage successResponse(){
        return new ResponseMessage(true,200);
    }
    public static ResponseMessage successResponse(Object o){
        return new ResponseMessage(true,200,o);
    }
}
